#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve() {
	int n, q;
	cin >> n >> q;
	vector v(n, vector(3, 0));
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		v[i][0] = l;
		v[i][1] = r;
		v[i][2] = i;
	}

	sort(v.begin(), v.end());

	while (q--) {
		int x;
		cin >> x;
		vector<int> target = {x, INT_MIN, INT_MIN};

		auto it = lower_bound(v.begin(), v.end(), target);
		int pos = it - v.begin();

		if (pos < n && v[pos][0] == x) {
			cout << v[pos][2] + 1 << '\n';
		} else if (pos > 0) {
			if (x <= v[pos-1][1]) {
				cout << v[pos-1][2] + 1 << '\n';
			} else {
				cout << -1 << '\n';
			}
		}
		else {
			cout << -1 << '\n';
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	solve();

	return 0;
}